/*
 * Report.java
 *
 * Created on September 28, 2006, 3:11 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.org.kasir.model;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

/**
 *
 * @author City_Z
 */
public class Report extends Thread{
    private String a;
    private String b;
    
    public Report()
    {
        
    }
    public Report(String a,String b)
    {
        this.setA(a);
        this.setB(b);
    }
    
    /** Creates a new instance of Report */
    
    public void Rep()
    {
        String fileName="E:/workspaceNetBeans/Kasir/report/";
        Map map = new HashMap();
	map.put("tanggalAwal",this.a);
        map.put("tanggalAhkir",this.b);
	try{
	//JasperCompileManager.compileReportToFile(fileName+"classic.jrxml");
	//JasperFillManager.fillReportToFile(fileName+"classic.jasper", map, getConnect());			
	//JasperExportManager.exportReportToPdfFile(fileName+"penjualan.jrprint");
	//JasperPrintManager.printReport(fileName+"classic.jrprint", true);
        //JasperRunManager.runReportToPdfFile(fileName+"classic.jrprint", map, getConnect());			
	//JasperViewer.viewReport(fileName+"classic.jrprint",false);	
	}
        catch(Exception e1){
	e1.printStackTrace();
	}
    }
     public static Connection getConnect()
	{
		Connection con=null;
		String url = "jdbc:mysql://localhost/dbkasir";
		String user = "root";
		String admin = "admin";
		try {
			try {
				Class.forName("com.mysql.jdbc.Driver").newInstance();
			} catch (InstantiationException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			} catch (IllegalAccessException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			con = DriverManager.getConnection(url,user,admin);
		} catch (ClassNotFoundException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		catch(SQLException e1)
		{
			e1.printStackTrace();
		}
		
		return con;
	}
     public void run()
     {
         Rep();
     }

    public String getA() {
        return a;
    }

    public void setA(String a) {
        this.a = a;
    }

    public String getB() {
        return b;
    }

    public void setB(String b) {
        this.b = b;
    }
}
